package com.weixin.common.exception;

import com.weixin.common.core.doman.ResultCode;

/**
 * 自定义异常
 *
 * @author zh
 */
public class CommonException extends RuntimeException {

    private final ResultCode resultCode;
    private final String msg;

    public CommonException(String msg) {
        super(msg);
        this.resultCode = ResultCode.FAIL;
        this.msg = msg;
    }

    public CommonException(ResultCode resultCode) {
        this.resultCode = resultCode;
        this.msg = resultCode.message();
    }

    public ResultCode getResultCode() {
        return resultCode;
    }

    public String getMsg() {
        return msg;
    }
}
